package com.itpan.Service.Impl;

import com.itpan.Entity.Customer;
import com.itpan.Entity.StatsByT;
import com.itpan.Mapper.CustomerMapper;
import com.itpan.Service.CustomerService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CustomerServiceImpl implements CustomerService {
    @Autowired
    private CustomerMapper customerMapper;
    @Override
    public List<Customer> getbymutil(Customer customer) {
        return customerMapper.getbyMutil(customer);
    }

    @Override
    public void addone(Customer customer) {
        customerMapper.addOne(customer);
    }

    @Override
    public List<Customer> getall() {
        return customerMapper.getall();
    }

    @Override
    public List<Customer> getallPage(Integer page, Integer pageSize) {
        RowBounds rowBounds=new RowBounds(page,pageSize);
        return customerMapper.getallPage(rowBounds);
    }

    @Override
    public Customer getById(String Id) {
        return customerMapper.getById(Id);
    }

    @Override
    public void addAll(List<Customer> list) {
        customerMapper.addAll(list);
    }

    @Override
    public void deleteById(String Id) {
        customerMapper.deleteById(Id);
    }

    @Override
    public void update(Customer customer) {
        customerMapper.updateCustomerByID(customer);
    }

    @Override
    public List<StatsByT> countSuppliersByProvince() {
        return customerMapper.countSuppliersByProvince();
    }
}
